<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>物料列表</title>
		<meta name="viewport" content=" height=device-height,
			          width=device-width,
			          initial-scale=1.0,
			          minimum-scale=1.0,
			          maximum-scale=1.0
			          user-scalable=no" />
		<script type="text/javascript" src="../js/jquery.min.js" charset="utf-8"></script>
		<link rel="stylesheet" href="../css/proListStyle.css" type="text/css" />
		<script type="text/javascript">
			$(function() {
				var token = localStorage.getItem("token");
				var ip = localStorage.getItem("ip");
				$.ajax({
					type: 'post', //类型
					url: ip + 'bom/list', //请求路径
					contentType: 'application/x-www-form-urlencoded', //默认
					dataType: 'json', //返回数据类型  可以是text：字符串  可以是json：json对象
					data: {
						'token': token,
					}, //数据
					success: function(result) {
						if(result.code == 200) {
							for(var Key in result.data) {
								var bomId = result.data[Key].id;
								var partsName = result.data[Key].partsName;
								var bomNum = result.data[Key].bomNum;
								var bomPrice = result.data[Key].price;
								var bomCategory = result.data[Key].bomCategory;
								var bomPicture = result.data[Key].bomPicture;
								var arr;
								if(bomPicture == null) {
									arr = 'http://39.108.187.126:8080/nop.png';
								} else {
									arr = bomPicture.split(',')[0];
								}
								var txts = '<tr onclick=' + 'getFileFull(' + bomId + '); >';
								txts = txts + '<td colspan="2" rowspan="5" width="1%"  style=" border: 5px solid;border-color:white; border-left: none;border-top:none;border-right:none; font-size: calc(10vw/3.75); background: #c9daf8; color: #c9daf8;  border-left: none;border-top:none;border-right:none;">产品</td>';
								txts = txts + '<td width="32%" colspan="2" style="font-size: calc(15vw/3.75);border:none;text-overflow:ellipsis">' + partsName + '</td></tr>';
								txts = txts + '<tr onclick=' + 'getFileFull(' + bomId + ');>';
								txts = txts + '<td width="11%" style="border:none;">编码:</td>';
								txts = txts + '<td style="border:none;">' + bomNum + '</td> </tr>';
								txts = txts + '<tr onclick=' + 'getFileFull(' + bomId + ');>';
								txts = txts + '<td width="11%" style="border:none;">类别:</td>';
								txts = txts + '<td style="border:none;">' + bomCategory + '</td> </tr>';
								txts = txts + '<tr style="color: red; "  onclick=' + 'getFileFull(' + bomId + ');>';
								txts = txts + '<td width="11%"style="border-right:none; border-top:none;border-left: none;">价格:</td>';
								txts = txts + '<td style="border-left: none;border-top:none;border-right:none;">' + bomPrice + '</td>';
								txts = txts + '<tr style="color: #c9daf8; background: #c9daf8;">';
								txts = txts + '<td width="11%" style=" border: 5px solid; border-color:white; border-left: none;border-top:none;border-right:none;font-size: calc(1vw/3.75);">不良库存数量：</td>';
								txts = txts + '<td style="border-left: none;border-top:none;border-right:none; border-color:white;"></td></tr>';
								$(".pro-ta").append(txts);
							}
						} else {
							alert('获取数据异常,请重新登录');
							//window.location.href = 'Login.html';
						}
					},
					error: function(data) { //若果传过来的数据为空
					}
				});
			});

			function getFileFull(id) {
				localStorage.setItem("bomId", id);
				window.location.href = 'materielInfoDetails.html';
			}

			function getProAdd() {
				window.location.href = 'materielInfoAdd.html';
			}
			function getselectList(){
				$.ajax({
					type: 'post', //类型
					url: ip + 'bom/selectList', //请求路径
					contentType: 'application/x-www-form-urlencoded', //默认
					dataType: 'json', //返回数据类型  可以是text：字符串  可以是json：json对象
					data: {
						'token': token,
					}, //数据
					success: function(result) {
						if(result.code == 200) {
							for(var Key in result.data) {
								var bomId = result.data[Key].id;
								var partsName = result.data[Key].partsName;
								var bomNum = result.data[Key].bomNum;
								var bomPrice = result.data[Key].price;
								var bomCategory = result.data[Key].bomCategory;
								var bomPicture = result.data[Key].bomPicture;
							}
						} else {
							alert('获取数据异常,请重新登录');
							//window.location.href = 'Login.html';
						}
					},
					error: function(data) { //若果传过来的数据为空
					}
				});
			}
		</script>
	</head>

	<body>
		<div style="margin-left: 5%;">
			<font>搜索 </font>
			<input type="text" style="height: 35px;margin-bottom: 5px;width: 70%; -webkit-border-radius: 10px;" />
			<span style="background:url(../img/search.png);line-height: 28px;position: absolute;left: 83%;top: 1%;width: 35px;height: 35px"></span>
		</div>
		<div style="color: #c9daf8; background: #c9daf8; width: 100%;font-size: calc(10vw/3.75);">
			<font>sdsdssd </font>
		</div>
		<table width="100%" class="pro-ta" border="1"  style=" border-collapse: collapse; border:none;"></table>
		<a id="a0" href="#" onclick="getProAdd()">
			<img src="../img/proadd.png" />
		</a>
	</body>

</html>
